x86/IRQ: avoid UB (or worse) in trace_irq_mask()
authorJan Beulich <jbeulich@suse.com>
Thu, 6 Jun 2019 12:09:56 +0000 (14:09 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 6 Jun 2019 12:09:56 +0000 (14:09 +0200)
commit9d89d2c431b1fd8817fb4cd20c495fe4bf6e770a
tree9723063bcc9a812284e985b2d1a8035ea6a73d4b
parent10a732930762f1c34f7d46cbda0d2d76b31c5e23
x86/IRQ: avoid UB (or worse) in trace_irq_mask()

Dynamically allocated CPU mask objects may be smaller than cpumask_t, so
copying has to be restricted to the actual allocation size. This is
particulary important since the function doesn't bail early when tracing
is not active, so even production builds would be affected by potential
misbehavior here.

Take the opportunity and also
- use initializers instead of assignment + memset(),
- constify the cpumask_t input pointer,
- u32 -> uint32_t.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
master commit: 6fafb8befa99620a2d7323b9eca5c387bad1f59f
master date: 2019-05-13 16:41:03 +0200
xen/arch/x86/irq.c